package com.hishop.ware.service.impl;

import com.hishop.common.utils.PageUtils;
import com.hishop.common.utils.Query;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.hishop.ware.dao.WmsWareOrderTaskDetailDao;
import com.hishop.ware.entity.WmsWareOrderTaskDetailEntity;
import com.hishop.ware.service.WmsWareOrderTaskDetailService;


@Service("wmsWareOrderTaskDetailService")
public class WmsWareOrderTaskDetailServiceImpl extends ServiceImpl<WmsWareOrderTaskDetailDao, WmsWareOrderTaskDetailEntity> implements WmsWareOrderTaskDetailService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String) params.get("key");

        QueryWrapper<WmsWareOrderTaskDetailEntity> wareOrderTaskEntityQuerWrapper = new QueryWrapper<WmsWareOrderTaskDetailEntity>();

        if (!StringUtils.isEmpty(key)) {
            wareOrderTaskEntityQuerWrapper.eq("id",key)
                    .or().like("order_sn",key)
                    .or().like("consignee_tel",key)
                    .or().like("delivery_address",key);
        }

        IPage<WmsWareOrderTaskDetailEntity> page = this.page(
                new Query<WmsWareOrderTaskDetailEntity>().getPage(params),
                wareOrderTaskEntityQuerWrapper
        );

        return new PageUtils(page);
    }

}